package com.huixuebao.exchange.controller.mechanism;

import com.huixuebao.common.bean.ApiResult;
import com.huixuebao.exchange.dto.MechanismDTO;
import com.huixuebao.exchange.dto.MechanismPolicyDTO;
import com.huixuebao.exchange.service.MechanismService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/exchangeApi/restAssured/mechanism")
public class MechanismController {

    @Autowired
    MechanismService mechanismService;

    /**
     * 获取放心学商户
     * @param current
     * @param size
     * @param cityIds
     * @param merchantsName
     * @param merchantsState
     * @param contactsName
     * @param contactsPhone
     * @return
     */
    @GetMapping("/getRestAssuredMechanism")
    public ApiResult<List<MechanismDTO>> getRestAssuredMechanism(Integer current, Integer size, String cityIds, String merchantsName, String merchantsState, String contactsName,
                                                                 String contactsPhone){

        return  mechanismService.getRestAssuredMechanism(current,size,cityIds,merchantsName,merchantsState,contactsName,contactsPhone);
    }

    /**
     * 获取所有机构信息
     * @param current
     * @param size
     * @return
     */
    @GetMapping("/getMechanismList")
    public ApiResult<List<MechanismDTO>> getMechanismList(Integer current, Integer size){
        return mechanismService.getMechanismList(current,size);
    }

    @GetMapping("/getMechanismItem")
    public ApiResult getMechanismItem(@RequestParam String id){

        return mechanismService.getMechanismItem(id);
    }

    @PostMapping("/addMechanismPolicyNews")
    public ApiResult addMechanismPolicyNews(@RequestBody MechanismPolicyDTO mechanismPolicyDTO){

        return mechanismService.addMechanismPolicyNews(mechanismPolicyDTO);
    }
 }
